package com.sky.mapper;

import com.sky.entity.SetmealDish;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author 周鹏
 * @version 1.0
 */
@Mapper
public interface SetMealDishMapper {
    List<Long> selectSetMealIdsByIds(List<Long> ids);

    void insertSetmealDishes(List<SetmealDish> setmealDishes);

    @Select("select * from setmeal_dish where setmeal_id = #{id}")
    List<SetmealDish> QueryById(Long id);

    @Delete("delete from  setmeal_dish where setmeal_id = #{id}")
    void deleteBySetmealId(Long id);

    void deleteBySetmealIds(List<Long> ids);

    @Select("SELECT d.status FROM dish d LEFT JOIN setmeal_dish sd on d.id = sd.dish_id where sd.setmeal_id = #{id}")
    List<Integer> selectDishesStatusBySetmealId(Long id);
}
